package com.huizu.api.service.impl;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.huizu.api.domain.MemberApi;
import com.huizu.api.mapper.MemberApiMapper;
import com.huizu.api.service.IMemberApiService;
import com.huizu.common.core.text.Convert;

import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 会员信息Service业务层处理
 *
 * @date 2021-09-14
 */
@Service
public class MemberApiServiceImpl implements IMemberApiService {
	@Autowired
	private MemberApiMapper dao;

	@Value("${huizu.url}")
	private String url;

	// 会员编号
	public String getMemberCode() {
		String code = "" + (int) ((Math.random() * 9 + 1) * 100000);
		return code;
	}

	// 用户注册
	@Override
	public int insertMember(Map<String, Object> map) {
		map.put("memberNum", getMemberCode());
		return dao.insertMember(map);

	}
	
	//用户信息
	public MemberApi getMemberNew(Map<String,Object> map){
		return dao.getMemberNew(map);
	}
	
	//编辑用户信息
	public int updateMember(Map<String,Object> map){
		return dao.updateMember(map);
	}

}
